<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">


<h:head>
</h:head> 

<h:body>

<ui:insert name="banner"/>
	<h:graphicImage value="/img/soccerbanner.png" style="width:1900px;height:300px"/>
	
<ui:insert name="toolbar"/>

<h:form>
	<rich:toolbar height="35px" itemSeparator="line">
		       
	       <rich:menuItem submitMode="ajax" label="#{msg.home}" action="/index">
	       		<f:facet name="icon">
                      <h:graphicImage value="/img/home.png" style="width:30px;height:30px"/>
                </f:facet>
	       </rich:menuItem>
	         	   
	       <rich:dropDownMenu rendered="#{rich:isUserInRole('pres')}">
	            <f:facet name="label"> 
	              <h:panelGroup>
	                 <h:outputText value="#{msg.jogador}"/>
	              </h:panelGroup>
	            </f:facet>
	       		
	       		<rich:menuItem submitMode="ajax" label="#{msg.cadastrarJogador}" action="#{jogadorManagedBean.populaTimes}" rendered="#{rich:isUserInRole('adm')}">
	       			<f:facet name="icon">
                         <h:graphicImage value="/img/cadastrar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem>
	       		<rich:menuSeparator/>
	       		<rich:menuItem submitMode="ajax" label="#{msg.apresentarJogadores}" action="#{jogadorManagedBean.listar}" rendered="#{rich:isUserInRole('pres')}">
	           		<f:facet name="icon">
                         <h:graphicImage value="/img/apresentar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem>
	       </rich:dropDownMenu>
	   
	  	
	       <rich:dropDownMenu rendered="#{rich:isUserInRole('adm')}">
	       		<f:facet name="label">
	       			<h:panelGroup>
	       				<h:outputText value="#{msg.time}"/>
	       			</h:panelGroup>
	       		</f:facet>
	       
	       		<rich:menuItem submitMode="ajax" label="#{msg.cadastrarTime}"	action="/adm/timeForm.jsf?faces-redirect=true">
	       			<f:facet name="icon">
                         <h:graphicImage value="/img/cadastrar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem>
	       		<rich:menuSeparator/>
	       		<rich:menuItem submitMode="ajax" label="#{msg.apresentarTimes}" action="#{timeManagedBean.listar}">
	       			<f:facet name="icon">
                         <h:graphicImage value="/img/apresentar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem> 		
	       </rich:dropDownMenu>
	   
	    
	    
	       <rich:dropDownMenu rendered="#{rich:isUserInRole('adm')}">
	       		<f:facet name="label">
	       			<h:panelGroup>
	       				<h:outputText value="#{msg.presidente}"/>
	       			</h:panelGroup>
	       		</f:facet>
	       		
	       		<rich:menuItem submitMode="ajax" label="#{msg.cadastrarPresidente}" action="#{presidenteManagedBean.populaTimes}">
	       			<f:facet name="icon">
                         <h:graphicImage value="/img/cadastrar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem>
	       		<rich:menuSeparator/>
	       		<rich:menuItem submitMode="ajax" label="#{msg.apresentarPresidentes}"	action="#{presidenteManagedBean.listar}">
	       			<f:facet name="icon">
                         <h:graphicImage value="/img/apresentar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem> 		
	       </rich:dropDownMenu>
	       
	       <rich:menuItem submitMode="ajax" action="#{localeManagedBean.portugueseLocale}" rendered="true" onclick="">
				<h:graphicImage value="/img/flag-brasil.png" style="width:30px;height:30px">
					<f:view locale="#{localeManagedBean.currentLocale}"
						contentType="text/html; charset=UTF-8" encoding="UTF-8">
					</f:view> 
				</h:graphicImage>
			</rich:menuItem>
			<rich:menuItem submitMode="ajax" action="#{localeManagedBean.englishLocale}" rendered="true" onclick="">
				<h:graphicImage value="/img/flag-eua.png" style="width:30px;height:30px">
					<f:view locale="#{localeManagedBean.currentLocale}"
						contentType="text/html; charset=UTF-8" encoding="UTF-8">
					</f:view> 
				</h:graphicImage>
			</rich:menuItem>
			
			<rich:dropDownMenu rendered="#{rich:isUserInRole('pres')}">
	       		<f:facet name="label">
	       			<h:panelGroup>
	       				<h:outputText value="#{msg.logsSistema}"/>
	       			</h:panelGroup>
	       		</f:facet>
	       		
	       		<rich:menuItem submitMode="ajax" label="#{msg.mostrarLogs}"	action="#{mercadoLogManagedBean.listar}">
	       			<f:facet name="icon">
                         <h:graphicImage value="/img/apresentar.png"  style="width:30px;height:30px" />
                    </f:facet>
	       		</rich:menuItem> 		
	       </rich:dropDownMenu>
			
  	</rich:toolbar>
</h:form>

<ui:insert name="corpo"/>
<br></br>
	<h:panelGroup rendered="#{not empty facesContext.externalContext.userPrincipal.name}">
		<h:outputText value="Usuario logado: #{facesContext.externalContext.userPrincipal.name} - " />
		<h:outputLink value="#{facesContext.externalContext.request.contextPath}/logoff.jsp">
			<h:outputText value="Logoff"/>
		</h:outputLink>
	<p/>
	</h:panelGroup>


</h:body> 
     
</html>